<template>
	<div>

		<van-cell class="cell_header_title" :title="title" />


		<div class="odd_detail">

			<!-- 			<div> 订单编号：{{odd_id}}</div>

			<div>订单性质：{{in_or_out?'入库单':'出库单'}}</div> -->

			<div> 所属库房：{{odd_detail.warehouse_name}}</div>


			<div> 制单人员：{{odd_detail.sponsor}}</div>

			<div>制单时间：{{getLocalTime_(odd_detail.create_time)}}</div>

			<div> 操作人员：{{odd_detail.operator?odd_detail.operator: '无人接单'}}</div>

			<div>完成时间：{{odd_detail.end_time?getLocalTime_(odd_detail.end_time): '未完成'}}</div>

			<div class="remark">备注说明：{{odd_detail.remark}}</div>


		</div>




		<!-- 商品渲染 -->

		<van-cell class="cell_header_title" title="商品列表(右滑对商品操作)" />


		<van-empty v-if="sku_list.length==0" description="没有对应的SKU" />
		<van-swipe-cell v-else v-for="item in sku_list">
			<van-card :tag="item.status=='success'?'操作完成':''"
				:title="item.sku_info[0].brand_name + item.sku_info[0].spu_name" :num="item.quantity?item.quantity:null"
				:desc="item['attribute_str']?item.attribute_str: ''" :price="item['price']"
				thumb="https://img01.yzcdn.cn/vant/ipad.jpeg">

				<template #tags>
					<van-tag plain type="success">货位:{{item.location_name}}</van-tag>
				</template>

			</van-card>
			<!-- <template #right v-show="item.status=='wait' && odd_detail.operator_id == cookie_user_id"> -->
			<template #right>
				<van-button v-show="item.status=='wait' && odd_detail.operator_id == get_cookie_user_id()"
					style="height: 100%;" square text="完成" type="primary" class="delete-button"
					@click="accomplish(item)" />
			</template>
		</van-swipe-cell>




		<!-- 接单 -->

		<van-button v-show="permission_operator" 
			@click="receiveOdd" v-if="Boolean(odd_detail.operator_id) == false"
			type="primary" size="large">接单
		</van-button>


		<van-button @click="successOdd"
			v-else-if="odd_detail.status!='success' && odd_detail.operator_id == get_cookie_user_id()" type="primary"
			size="large">订单完成
		</van-button>
		
		

		<!-- <van-icon  v-else-if="odd_detail.status=='success'" name="passed" size="34" color="green"/> -->



		<svg v-else-if="odd_detail.status=='success'" style="position: fixed; top: 0; right: 0;" t="1618838732663"
			class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3645"
			width="100" height="100">
			<path
				d="M1002.71 371.841l-151-238.09c-13.186-20.761-40.739-26.904-61.562-13.833L36.552 596.656C15.785 609.84 9.648 637.394 22.69 658.098l151 238.12c13.186 20.71 40.738 26.847 61.506 13.778L988.82 433.29c20.823-13.193 27.08-40.711 13.89-61.45z m-30.077 35.862L219.009 884.47c-6.666 4.2-15.39 2.234-19.59-4.404l-151-238.12c-4.2-6.666-2.233-15.362 4.433-19.619L806.505 145.59c6.672-4.172 15.423-2.2 19.562 4.437l151.062 238.115c4.052 6.523 2.056 15.276-4.496 19.561zM322.985 256.618l12.515 30.014 16.215-28.166 32.395-2.615-21.824-24.143 7.433-31.576-29.61 13.31-27.813-16.834 3.523 32.339-24.671 21.033 31.837 6.638z m191.886-89.352l-15.567-28.576-13.186 29.752-32.014 6.11 24.171 21.676-4.172 32.22 28.196-16.302 29.404 13.953-6.785-31.838 22.29-23.615-32.337-3.38z m292.548 478.676l-25.762-19.8-0.115 32.457-26.904 18.243 30.986 10.22 9.133 31.162 19.21-26.23 32.514 0.911-19.09-26.372 11.014-30.462-30.986 9.87zM702.267 775.35l-12.276-30.105-16.482 28.053-32.367 2.35 21.619 24.26-7.696 31.542 29.781-13.01 27.7 17.21-3.261-32.367 24.67-21-31.688-6.933z m-192.625 88l15.425 28.696 13.452-29.667 32.015-5.724-24.029-21.914 4.41-32.19-28.315 16.01-29.258-14.158 6.52 31.776-22.615 23.53 32.395 3.641zM221.095 382.418l25.615 20.119 0.38-32.485 27.024-18.153-30.814-10.43-8.9-31.308-19.443 26.052-32.514-1.176 18.828 26.495-11.224 30.548 31.048-9.662zM106.691 522.665c-3.405-137.52 63.476-273.48 188.071-352.285 124.623-78.805 276.124-81.038 399.19-19.295l29.725-18.8c-36.42-20.353-75.6-35.248-116.867-44.5-55.134-12.395-111.29-13.949-166.806-4.814-57.48 9.513-111.818 30.252-161.456 61.71-49.61 31.456-91.672 71.637-124.863 119.513-32.133 46.172-54.718 97.605-67.142 152.647C77.29 458.046 74 499.813 76.88 541.438l29.811-18.773z m809.286-21.028c3.552 137.52-63.329 273.481-187.924 352.257-124.595 78.89-276.123 81.067-399.162 19.324l-29.782 18.829c36.42 20.294 75.629 35.22 116.9 44.47 55.129 12.396 111.286 14.011 166.8 4.815 57.481-9.515 111.82-30.224 161.43-61.682s91.67-71.638 124.89-119.486c32.014-46.229 54.6-97.629 66.995-152.643 9.28-41.238 12.514-83.033 9.633-124.656l-29.78 18.772zM384.637 312.19c34.896-22.029 73.282-33.781 111.82-36.13l45.995-29.08c-60.772-7.167-121.628 6.523-174.144 39.685-52.371 33.129-90.761 82.329-110.233 140.248l45.966-29.076c18.682-33.957 45.735-63.562 80.597-85.647z m253.51 399.895c-34.895 22.09-73.253 33.838-111.79 36.186l-45.968 29.08c60.744 7.167 121.572-6.552 174.115-39.714 52.372-33.1 90.762-82.328 110.205-140.248l-45.939 29.138c-18.68 33.805-45.76 63.53-80.623 85.558zM299.196 648.17"
				p-id="3646" fill="#1296db"></path>
			<path
				d="M139.871 644.476l136.065-87.271 1.084-14.717 23.277 1.43-4.67 11.173c21.238 33.114 35.53 54.729 42.878 64.804l-10.793 13.934-7.966-12.418-118.358 75.912 46.196 72.026c5.04 9.236 12.981 9.983 23.808 2.256l111.834-71.729c11.54-6.617 15.262-14.464 11.204-23.545-4.071-9.07-10.747-21.533-20.036-37.393l4.66-2.988c18.053 28.148 32.095 39.789 42.12 34.913 0.781 13.521-7.268 24.907-24.122 34.166l-129.54 83.085c-12.698 8.913-23.33 6.02-31.913-8.743-36.455-56.838-57.84-89.473-64.12-97.919l26.215-6.295-3.739 10.577 4.248 6.624 118.358-75.914-35.575-55.466-107.175 68.74c-8.081 5.184-15.007 10.795-20.774 16.83l-13.166-2.072z"
				p-id="3647" fill="#1296db"></path>
			<path
				d="M254.028 799.253c-9.204 0-17.154-5.618-23.63-16.699-36.07-56.238-57.542-89.033-63.81-97.464l-5.508-7.408 46.1-11.07-5.829 16.484 106.788-68.494-28.994-45.204-102.044 65.45c-7.633 4.895-14.247 10.246-19.659 15.909l-2.202 2.305-32.164-5.054 147.005-94.289 1.302-17.683 37.842 2.322-6.743 16.132c20.194 31.449 33.965 52.239 40.947 61.814l2.699 3.701-18.886 24.381-9.335-14.554-108.097 69.332 43.125 67.266c2.381 4.364 4.535 4.364 5.454 4.364 1.666 0 4.658-0.72 9.463-4.15l0.25-0.17 112.095-71.886c12.512-7.174 9.918-12.98 8.67-15.771-3.964-8.832-10.604-21.216-19.73-36.8l-2.958-5.052 14.717-9.438 3.29 5.13c19.213 29.954 28.98 33.188 32.29 33.188 0.736 0 1.383-0.147 2.035-0.466l8.225-4 0.527 9.13c0.919 15.948-8.195 29.324-27.089 39.758l-129.267 82.91c-5.776 4.031-11.455 6.076-16.88 6.076z m-72.413-113.967c9.857 14.458 29.67 44.887 59.114 90.794l0.139 0.227c4.15 7.136 8.577 10.754 13.16 10.754 2.902 0 6.262-1.325 9.984-3.936l0.21-0.142 3.198-2.051c-3.154 1.375-6.145 2.053-9.03 2.053-4.668 0-11.224-1.831-16.047-10.516l-55.129-85.956 0.992-2.81-6.591 1.583z m216.271-15.97a186.681 186.681 0 0 1 2.107 4.519c2.641 5.914 4.737 16.392-6.372 26.154l0.498-0.302c11.664-6.409 18.395-13.574 20.385-21.759-5.203-0.57-10.69-3.395-16.618-8.611z m-72.904-51.032l3.199 4.987 2.726-3.52c-7.92-11.248-21.2-31.417-40.412-61.37l-1.726-2.69 2.597-6.216-8.71-0.534-0.288 3.907 0.457-0.293 42.157 65.729zM559.304 435.048L555.88 409.2l-154.705 99.226c4.075 3.63 6.643 6.255 7.705 7.91 2.123 3.313 2.607 7.494 1.445 12.51-1.165 5.04-4.096 8.671-8.793 10.9-4.702 2.248-7.402 2.812-8.116 1.7-1.062-1.656-1.33-3.42-0.79-5.335 0.978-5.3 0.958-11.132-0.044-17.499-1.015-6.36-3.204-13.52-6.555-21.501l4.66-2.99 7.303 9.337 152.84-98.03 2.146-13.059 25.802 3.315c-8.606 7.088-13.824 20.166-15.616 39.226l-3.858 0.137z m-139.74 149.216l158.433-101.616 6.015-21.385 30.72 4.833-70.828 45.429 35.576 55.466c4.684 8.682 12.93 9.233 24.741 1.66l34.482-22.118c5.846-4.536 7.898-9.538 6.14-15.038-1.767-5.476-7.654-16.707-17.65-33.665l3.73-2.39c6.278 8.441 12.2 15.944 17.727 22.513 5.537 6.58 12.422 8.793 20.678 6.602 0.33 11.474-6.518 21.305-20.526 29.522l-42.87 27.498c-16.426 11.301-28.706 10.614-36.844-2.075l-38.23-59.607-33.551 21.519c8.05 16.652 13.59 31.795 16.634 45.416 3.036 13.643 1.492 27.287-4.645 40.953-6.149 13.677-19.823 31.993-41.044 54.953l-3.056-2.715c23.45-29.062 35.492-51.977 36.141-68.75 0.634-16.764-5.355-37.059-18.009-60.89l-40.075 25.703-11.984 10.024-11.705-1.842z m1.929-50.311l104.38-66.948 4.811-17.108 26.334 4.142-102.516 65.752c-8.708 5.584-15.313 10.99-19.842 16.23l-13.167-2.068z m13.039-100.67l0.8-2.85c13.395-2.347 23.018-3.079 28.87-2.158 5.852 0.92 9.666 2.764 11.433 5.52 1.776 2.768 2.463 6.598 2.112 11.497-0.366 4.91-1.169 7.76-2.406 8.555-1.864 1.194-5.19-0.562-9.97-5.291-7.442-6.126-17.717-11.22-30.839-15.272z"
				p-id="3648" fill="#1296db"></path>
			<path
				d="M468.671 691.259l-11.87-10.543 3.652-4.524c22.493-27.876 34.2-49.798 34.794-65.158 0.537-14.25-4.26-31.688-14.277-51.902l-34.102 21.872-13.812 11.553-30.284-4.761L572.756 478.77l6.854-24.368 51.914 8.167-79.2 50.796 32.52 50.732c1.78 3.298 3.544 3.752 5.187 3.752 1.892 0 5.319-0.75 10.899-4.33l34.239-21.96c5.18-4.107 4.295-6.87 3.867-8.206-1.11-3.443-4.983-11.877-17.093-32.428l-2.979-5.057 13.456-8.63 3.394 4.564c6.07 8.162 11.96 15.641 17.5 22.225 4.062 4.83 8.502 6.217 14.451 4.636l7.435-1.972 0.222 7.69c0.395 13.77-7.488 25.508-23.429 34.89l-42.687 27.382c-8.829 6.06-16.626 9.007-23.832 9.007-6.05 0-14.695-2.232-21.516-12.87l-34.94-54.475-23.91 15.335c6.982 15.113 11.95 29.17 14.782 41.849 3.315 14.894 1.621 29.958-5.033 44.778-6.489 14.432-20.267 32.942-42.129 56.593l-4.057 4.389z m19.895-144.01l0.144 0.272c13.093 24.655 19.389 46.18 18.717 63.978a48.496 48.496 0 0 1-0.498 5.251c2.856-9.57 3.197-18.995 1.06-28.599-2.88-12.89-8.183-27.437-15.768-43.248l-3.655 2.346z m47.527-30.484l38.126 59.443c4.173 6.508 8.421 7.26 11.253 7.26 4.473 0 9.985-2.187 16.393-6.5-4.278 2.061-8.185 3.072-11.835 3.072-4.72 0-11.274-1.731-15.798-9.939l-35.354-55.12-2.785 1.784z m113.674 10.454c0.351 0.882 0.642 1.683 0.877 2.405 1.365 4.27 2.225 12.255-6.077 19.928l1.152-0.733c8.996-5.277 14.47-11.007 16.557-17.376-4.566-0.202-8.748-1.616-12.509-4.224z m-61.355-59.094l-2.61 9.286 12.138-7.786-9.528-1.5z m-193.63 79.967c-2.758 0.002-5.126-1.221-6.495-3.353-1.953-3.045-2.507-6.48-1.615-9.961 0.804-4.528 0.766-9.645-0.112-15.219-0.929-5.815-3-12.578-6.154-20.09l-1.983-4.723 13.643-8.752 7.304 9.337 63.512-40.736a57.624 57.624 0 0 1-1.588-1.5c-6.792-5.527-16.399-10.232-28.561-13.988l-5.674-1.753 3.44-12.265 3.78-0.662c14.362-2.517 24.218-3.22 30.868-2.176 7.728 1.216 12.837 3.915 15.617 8.25 1.87 2.914 2.902 6.415 3.124 10.619l61.366-39.36 2.66-16.19 45.611 5.859-10.873 8.956c-7.281 5.998-11.796 17.804-13.421 35.093l-0.501 5.33-14.742 0.527-2.892-21.827-140.095 89.855c1.356 1.43 2.335 2.63 3.008 3.68 3.011 4.696 3.783 10.411 2.296 16.995l104.327-66.914 5.652-20.09 47.525 7.476-116.016 74.412c-8.163 5.234-14.395 10.31-18.523 15.084l-2.213 2.562-24.691-3.88c-2.086 2.747-4.85 4.963-8.221 6.564-4.106 1.963-6.999 2.84-9.364 2.84z m3.05-34.478a70.449 70.449 0 0 1 0.769 4.036c0.921 5.861 1.08 11.397 0.477 16.512 2.937-1.443 4.573-3.512 5.308-6.69 0.785-3.386 0.577-5.952-0.637-7.846-0.248-0.387-1.394-1.932-5.918-6.012z m137.254-56.854l-1.408 5.01 6.549-4.202-5.14-0.808z m-81.39-22.6c6.03 2.897 11.23 6.134 15.548 9.69l0.414 0.372a43.886 43.886 0 0 0 1.91 1.789c0.035-0.36 0.07-0.749 0.101-1.17 0.25-3.49-0.152-6.176-1.165-7.755-0.543-0.846-2.768-2.085-7.25-2.79-2.3-0.361-5.55-0.41-9.557-0.136z m107.049-34.649l1.397 10.547c1.332-3.623 2.896-6.874 4.7-9.764l-6.097-0.783z m-2.709-0.348l-0.26 1.58 2.096-1.345-1.836-0.235zM888.477 378.152l-11.649-42.77 4.26-1.564c8.485 18.712 14.506 30.824 18.041 36.335s8.447 9.772 14.75 12.74c2.649 1.404 2.735 2.92 0.26 4.507-4.354 2.793-13.68 6.037-27.947 9.746-14.291 3.707-34.686 1.998-61.184-5.158-7.933 30.027-20.574 56.813-37.886 80.383l-3.056-2.713c15.641-30.28 24.868-57.614 27.645-81.995-25.528-12.436-52.71-37.066-81.577-73.87l-73.624 47.223 24.555 40.336 42.87-27.496 3.077-13.658 21.413 2.622-4.67 11.175c19.375 34.312 29.188 55.091 29.447 62.32 0.252 7.25-2.908 15.302-9.477 24.19-6.817-6.528-19.278-7.5-37.375-2.903l-2.125-3.312c12.859-5.91 21.814-10.082 26.822-12.528 5.016-2.433 6.457-6.66 4.34-12.716-2.122-6.033-11.238-22.969-27.334-50.82l-43.802 28.094c27.522 47.012 35 87.382 22.452 121.138l-3.458-1.291c3.058-30.77-2.465-58.19-16.584-82.252-14.109-24.05-25.06-42.147-32.85-54.294-7.782-12.134-14.83-22.42-21.108-30.861l21.555-3.308 71.76-46.026a12127.082 12127.082 0 0 0-33.333-41.716l29.54-7.263-2.276 10.807c5.666 8.834 12.651 18.377 20.98 28.607l51.257-32.875 5.614-19.96 29.258 4.602-82.944 53.2c27.092 34.034 50.075 55.515 68.953 64.44 0.718-9.809 0.2-21.543-1.55-35.228-1.754-13.663-4.404-28.723-7.92-45.164l28.067 0.694-5.734 9.518c3.948 29.419 4.94 54.871 2.958 76.39 21.899 5.433 41.756 6.335 59.59 2.674zM734.35 244.49c17.296-1.746 29.266-2.212 35.918-1.422 6.647 0.813 10.662 3.294 12.029 7.474 1.375 4.194 1.248 7.78-0.348 10.739-1.6 2.981-2.718 4.666-3.33 5.059-2.49 1.597-5.765 0.592-9.839-3.037-5.756-4.872-17.64-9.718-35.632-14.536l1.202-4.277z"
				p-id="3649" fill="#1296db"></path>
			<path
				d="M710.29 535.302l-13.575-5.066 0.464-4.672c2.915-29.325-2.394-55.758-15.775-78.565-14-23.864-25.01-42.062-32.724-54.088-7.582-11.82-14.603-22.086-20.87-30.515l-6.043-8.126 30.287-4.648 64.989-41.683a11708.523 11708.523 0 0 0-29.111-36.414l-5.986-7.454 44.207-10.869-0.54-0.145 3.994-14.218 4.133-0.416c11.995-1.211 21.651-1.825 28.7-1.825 3.404 0 6.2 0.135 8.55 0.415 11.454 1.401 15.62 7.1 17.102 11.632 0.687 2.098 1.093 4.12 1.217 6.058l4.09-14.542 50.451 7.935-90.73 58.193c20.653 25.337 38.81 43.03 54.158 52.786-0.061-7.21-0.665-15.332-1.806-24.266-1.711-13.332-4.348-28.359-7.836-44.661l-1.616-7.56 46.275 1.144-10.04 16.67c3.45 26.517 4.5 50.136 3.127 70.326 10.743 2.342 21.023 3.528 30.623 3.53h0.003c5.069 0 10.031-0.331 14.826-0.988l-11.353-41.688 14.822-5.443 2.338 5.155c8.307 18.32 14.236 30.284 17.622 35.561 2.945 4.592 6.94 8.033 12.216 10.517l0.258 0.13c4.21 2.234 5.2 5.224 5.287 7.34 0.087 2.104-0.639 5.147-4.592 7.682-4.992 3.202-14.431 6.543-29.703 10.514-5.368 1.392-11.535 2.098-18.333 2.098-11.238 0-24.708-1.932-40.108-5.75-8.16 28.282-20.677 54.02-37.25 76.586l-3.96 5.39-11.6-10.299 2.174-4.21c14.35-27.776 23.241-53.222 26.468-75.715-24.064-12.783-49.705-36.043-76.334-69.245l-63.972 41.03 18.214 29.921 35.512-22.776 3.74-16.599 34.872 4.271-6.626 15.85c25.075 44.63 28.566 56.86 28.768 62.499 0.3 8.622-3.289 18.051-10.667 28.032l-4.117 5.568-5-4.79c-5.074-4.86-16.092-5.351-31.66-1.396l-4.257 1.08-8.285-12.91 6.372-2.928c13.468-6.19 21.95-10.152 26.692-12.467 1.482-0.72 2.64-1.282 1.262-5.228-1.28-3.637-6.49-14.336-23.67-44.25l-33.543 21.513c25.964 46.336 32.69 87.108 19.994 121.26l-2.126 5.73zM643.487 363.27c4.832 6.847 10.007 14.568 15.454 23.06 7.799 12.162 18.895 30.499 32.976 54.5a130.086 130.086 0 0 1 10.15 21.61c-4.366-16.459-11.987-34.035-22.855-52.66l-0.11 0.071-28.978-47.599-6.637 1.018z m106.87 85.588c4.462 0.413 8.387 1.468 11.748 3.154 3.482-5.75 5.163-10.941 5.004-15.487-0.1-2.812-3.095-14.254-28.663-59.533l-1.467-2.597 2.717-6.503-7.953-0.975-0.893 3.97 2.478 4.288c21.915 37.918 26.366 47.75 27.808 51.848 3.158 9.035 0.447 16.402-7.432 20.222-0.963 0.471-2.074 1.007-3.347 1.613z m-18.85-143.188l3.422 4.362c28.17 35.917 54.902 60.193 79.45 72.152l3.875 1.887-0.487 4.282a166.389 166.389 0 0 1-2.412 14.924 251.262 251.262 0 0 0 3.759-12.845l1.565-5.926 5.917 1.598c25.217 6.81 44.942 8.547 58.066 5.143 10.02-2.605 16.437-4.687 20.547-6.297A39.904 39.904 0 0 1 894 373.443a63.071 63.071 0 0 1-0.868-1.397l2.934 10.772-6.362 1.305c-7.532 1.546-15.504 2.33-23.697 2.33h-0.004c-12.074 0-25.056-1.702-38.583-5.06l-5.082-1.261 0.481-5.214c1.928-20.93 0.941-46.17-2.929-75.019l-0.284-2.122 1.43-2.373-9.902-0.245c2.785 13.743 4.945 26.53 6.43 38.104 1.794 14.031 2.326 26.294 1.582 36.449l-0.648 8.864-8.035-3.8c-19.914-9.414-43.177-31.055-71.117-66.155l-4.204-5.282 0.5-0.322c-8.134-10.036-15.137-19.613-20.823-28.475l-1.348-2.103 0.792-3.76-10.844 2.666c8.11 10.12 17.286 21.614 27.368 34.282l0.267 0.334 0.454-0.29z m-5.078-35.625c4.495 6.839 9.797 14.121 15.819 21.727l30-19.243c-2.403-0.791-4.87-2.321-7.459-4.616-3.495-2.933-12.098-7.602-33.219-13.258l-1.798-0.481-3.343 15.87z m75.77-16.156l-2.21 7.859 10.277-6.59-8.067-1.27z m-47.835-4.873c8.365 3.127 14.431 6.318 18.351 9.635l0.116 0.102c1.122 0.998 1.948 1.554 2.5 1.861a52.175 52.175 0 0 0 1.246-2.216c0.294-0.544 1.17-2.165-0.074-5.956-0.695-2.128-4.178-2.981-6.978-3.324-3.316-0.394-8.48-0.436-15.161-0.102z"
				p-id="3650" fill="#1296db"></path>
		</svg>
		
		<div style="height: 160px;"></div>
	</div>
</template>

<script>
	import Cookies from 'js-cookie'
	import get_odd_detail from '../../utils/get_odd_detail.js'
	import recive_odd from '../../utils/receive_odd.js'
	import sku_account_success from '../../utils/sku_account_success.js'
	import success_odd from '../../utils/success_odd.js'
	import {
		get_duty_warehouse_ship
	} from '../../utils/get_duty_ship.js'
	import {
		get_sku_attribute
	} from '../../utils/get_sku_attribute.js'

	import {
		getLocalTime
	} from '../../utils/date.js'



	import {
		Toast,
		Dialog
	} from 'vant'

	export default {
		name: '',
		components: {},
		props: {},
		data() {
			return {
				title: '',
				odd_id: null,
				in_or_out: null,
				sku_list: [],
				odd_detail: {},
				warehouse_id: '',

				cookie_user_id: '',
				permission_operator: false,
			}
		},
		methods: {

			get_cookie_user_id() {

				// console.log(Cookies.get('user_id'))
				this.cookie_user_id = Cookies.get('user_id')

				return Cookies.get('user_id')
			},

			getLocalTime_(nS) {
				return getLocalTime(nS)
			},

			receiveOdd() {

				Dialog.confirm({
						title: '接收订单',
						message: '确定要成为该定单操作员',
					})
					.then(() => {
						// on confirm
						recive_odd(Cookies.get('user_id'), this.odd_id,

							(res) => {
								console.log(res)

								// this.odd_detail.operator_id = Cookies.get('user_id')

								location.reload()
							}
						)
					})
					.catch(() => {
						// on cancel
						console.log('catch')
					});

			},

			successOdd() {

				Dialog.confirm({
						title: '提交订单',
						message: '请确所有认货物已经完成操作！！',
					})
					.then(() => {
						let num = 0
						// console.log(this.sku_list)
						for (let i = 0; i < this.sku_list.length; i++) {

							if (this.sku_list[i].status == 'success') {
								num++
							}
						}

						if (this.sku_list.length == num) {


							success_odd(this.odd_id,
								(res) => {
									console.log(res)
									Toast('已提交')
									this.odd_detail.status = 'success'

								}

							)






						} else if (this.sku_list.length != num) {
							// console.log('还有未完成的项目')
							Toast('还有未完成的项目')
						}

					})
					.catch(() => {
						// on cancel
						console.log('catch')
					});

			},

			get_odd_detail_call_back(res) {

				console.log(res)


				this.odd_detail = res.odd_detail
				this.warehouse_id = res.odd_detail.warehouse_id
				this.sku_list = res.sku_detail
				this.in_or_out = this.odd_detail.in_or_out

				let val = this.in_or_out ? '入库单' : '出库单'
				this.title = '订单详情：' + this.odd_id + '号' + val

				// console.log(val)
			},

			//完成一条item时
			accomplish(item) {

				Dialog.confirm({
						title: '当前产品操作完成',
						message: '确定产品已经操作完成',
					})
					.then(() => {
						// on confirm
						// console.log(item)

						sku_account_success(item.id,

							(res) => {
								// console.log(res)
								item.status = 'success'

								Toast('提交成功')

							}
						)



					})
					.catch(() => {
						// on cancel
						console.log('catch')
					});

			},



		},
		computed: {},
		watch: {
			warehouse_id: function(val, oldVal) {
				// console.log(val)
				console.log('new: %s, old: %s', val, oldVal)
				// this.now_sku_id = val
				
				get_duty_warehouse_ship(
					(res) => {
						for (let i = 0; i < res.warehouse_list.length; i++) {
							let val = res.warehouse_list[i]
							if (val.in_operation == true && val.warehouse_id == this.warehouse_id && this.in_or_out == true) {
								this.permission_operator = true
							} else if (val.out_operation == true && val.warehouse_id == this.warehouse_id && this.in_or_out == false) {
								this.permission_operator = true
							}
						}
					}
				)

			}
		},
		created() {},
		mounted() {

			this.odd_id = this.$route.query.odd_id
			if (this.odd_id == null || this.odd_id == '') {
				Toast('非法访问')
				this.$router.push('/')
			}

			get_odd_detail(this.odd_id, this.get_odd_detail_call_back)

			this.get_cookie_user_id()

			// success_odd()

			
			



		},
	}
</script>

<style scoped lang="less">
	.cell_header_title {
		background-color: #F0F0F0;
		font-weight: 800;
	}

	.odd_detail {
		div {
			margin-left: 10px;
		}

		.remark {
			color: red;
		}
	}
</style>
